package com.cy.pj.sys.advice;

import com.cy.pj.sys.controller.pojo.jsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(RuntimeException.class)
    public jsonResult doHandleRuntimeException(RuntimeException e){
        e.printStackTrace();
        log.error("exception {}",e.getMessage());
        return new jsonResult(e);
    }
    @ExceptionHandler(ServiceException.class)
    public jsonResult ServiceException(RuntimeException e){
        e.printStackTrace();
     //   log.error("exception {}",e.getMessage());
        return  new jsonResult(e);
    }

}
